package cn.internship.modules.manage.service.impl;

import cn.internship.modules.manage.entity.dto.ClassInfoSearch;
import cn.internship.modules.manage.entity.vo.ClassInfoList;
import cn.internship.modules.manage.entity.vo.ReportList;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.internship.common.utils.PageUtils;
import cn.internship.common.utils.Query;

import cn.internship.modules.manage.dao.ClassInfoDao;
import cn.internship.modules.manage.entity.ClassInfoEntity;
import cn.internship.modules.manage.service.ClassInfoService;


@Service("classInfoService")
public class ClassInfoServiceImpl extends ServiceImpl<ClassInfoDao, ClassInfoEntity> implements ClassInfoService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {

        IPage<ClassInfoEntity> page = this.page(
                new Query<ClassInfoEntity>().getPage(params),
                new QueryWrapper<ClassInfoEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public PageUtils listByPage(ClassInfoSearch search) {
//        LambdaQueryWrapper<ClassInfoEntity> userLambdaQueryWrapper = Wrappers.lambdaQuery();
//        userLambdaQueryWrapper.like(StringUtils.isNotEmpty(search.getClassNo()),ClassInfoEntity::getClassNo,search.getClassNo());
//
//        Page<ClassInfoEntity> pageInfo = new Page<>(search.getPage() , search.getLimit());
//        IPage<ClassInfoList> page =this.baseMapper.queryList(pageInfo,userLambdaQueryWrapper);
//        return new PageUtils(page);
        Page<ClassInfoList> page=new Page<>(search.getPage(),search.getLimit());
        this.baseMapper.queryList(page,search);
        return  new PageUtils(page);
    }

}